﻿using Infrastructure.Utils;
using Infrastructure.WebApi;

namespace Application.DTO
{
    #region 用户信息
    public class UserInfo
    {
        public long Id { get; set; }
        public string UserName { get; set; }
        public string LoginCode { get; set; }
        public string RoleKey { get; set; }
    }
    #endregion

    #region 登录
    public class UserLoginRequest
    {
        [CustomRequired(ErrorMessage = "请输入账号")]
        public string LoginCode { get; set; }
        [CustomRequired(ErrorMessage = "请输入秘密")]
        public string Password { get; set; }
    }
    public class UserLoginResponse
    {
        public UserInfo User { get; set; }
        public string access_token { get; set; }
        public string refresh_token { get; set; }
    }

    public class RefreshTokenRequest
    {
        [CustomRequired(ErrorMessage = "缺失RefreshToken值")]
        public string RefreshToken { get; set; }
    }
    public class RefreshTokenResponse
    {
        public string AccessToken { get; set; }
    }
    #endregion

    #region 新增、修改
    public class UserFormRequest
    {
        [CustomRequired(ErrorMessage = "账户名是必填项")]
        public string LoginCode { get; set; }
        public string UserName { get; set; }
        public string Note { get; set; }
        [CustomRequired(ErrorMessage = "角色是必填项")]
        public string RoleKey { get; set; }
    }
    public class UserEditRequest : UserFormRequest
    {
        public int Id { get; set; }
    }
    public class CreateManagerRequest : UserFormRequest
    {
        [CustomRequired]
        public string Password { get; set; }
    }
    #endregion

    #region 查询
    public class UserRequest : PageRequest
    {
        public string Keyword { get; set; }
    }
    public class UserResponse : UserInfo
    {

    }
    #endregion

    #region 获取权限-前端路由
    public class RouteInfo
    {
        public long ParentId { get; set; }
        public long Id { get; set; }
        public string Path { get; set; }
        public string Name { get; set; }
        public string Component { get; set; }
        public bool Hidden { get; set; }
        public MenuType Type { get; set; }
        public MetaInfo Meta { get; set; }
        public class MetaInfo
        {
            public string Title { get; set; }
            public string Icon { get; set; }
        }
    }
    #endregion
}
